<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title></title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all"/>
</head>
<body layadmin-themealias="default">
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body" pad15="">
                    <div class="layui-form" wid100="" lay-filter="">
                        <input type="hidden" name="id" value="{$userinfo.id}"/>
                        <input type="hidden" name="room_id" value="{$room_id}">
                        <input type="hidden" id="actionType" value="{$type}">
                        <input type="hidden" name="chat_id" value="{$chat_id}">
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户ID</label>
                            <div class="layui-input-block">
                                <input type="text" disabled value="{$userinfo.id}" class="layui-input" lay-verify=""/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户昵称</label>
                            <div class="layui-input-block">
                                <input type="text" disabled value="{$userinfo.nick_name}" class="layui-input" lay-verify=""/>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户贵族</label>
                            <div class="layui-input-block">
                                <div class="layui-form-mid ">{$userinfo.nobel_str|default='无'}</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户等级</label>
                            <div class="layui-input-block">
                                <div class="layui-form-mid ">Lv{$userinfo.user_level}</div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">禁言时间：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="ban_time" lay-filter="ban_timeM" value="6" title="10分钟">
                                <input type="radio" name="ban_time" lay-filter="ban_timeM" value="1" title="30分钟">
                                <input type="radio" name="ban_time" lay-filter="ban_timeM" value="2" title="2小时">
                                <input type="radio" name="ban_time" lay-filter="ban_timeM" value="3" title="6小时">
                                <input type="radio" name="ban_time" lay-filter="ban_timeM" value="4" title="1天">
                                <input type="radio" name="ban_time" lay-filter="ban_timeM" value="5" title="7天">
                                <input type="radio" checked name="ban_time" {$ban_time==0?'checked':''} lay-filter="ban_timeM" value="0" title="永久">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">禁言原因</label>
                            <div class="layui-input-inline">
                                <select name="ban_type">
                                    {volist name="ban_type" id="vo"}
                                    <option value="{$key}">{$vo}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block text-center">
                                <button class="layui-btn" lay-submit="" lay-filter="user-edit">
                                    确认保存
                                </button>
                                <button class="layui-btn layui-btn-primary" id="close">
                                    取消
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: "/layuiadmin/" //静态资源所在路径
        , version: "{:config('other.ui_version')}"
    }).extend({
        index: "lib/index", //主入口模块
    }).use(["index", "user", "form", "admin"], function () {
        var $ = layui.$,
            form = layui.form,
            admin = layui.admin;
        var index = parent.layer.getFrameIndex(window.name);

        $("#close").on("click", function () {
            parent.layer.close(index);
        });

        form.on("submit(user-edit)", function (obj) {
            //提交
            layer.load();
            admin.req({
                url: "/admin/user/setBanned",
                data: obj.field,
                success: function (res) {
                    let type = $('#actionType').val();
                    layer.closeAll("loading");
                    if (res.code == 0) {
                        parent.layer.close(index);
                        parent.layer.msg(res.msg, {icon: 1, time: 2000});
                        if (type == 2) {
                            parent.layui.table.reload("LAY-ads-applaunch-manage");
                        } else if (type == 3) {
                            parent.location.reload();
                        } else {
                            parent.layui.table.reload("LAY-user-manage");
                        }
                    }
                },
                complete: function () {
                    layer.closeAll("loading");
                },
            });
            return false;
        });
    });
</script>
</body>
</html>
